package com;

import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

public class GameMapTest {

	boolean [][] beforeMap = {{true,false,true,true},
			{false,false,true,true},
			{true,true,false,false},
			{true,true,true,true}};
	int[][] countOfNeighbor = {{0,3,3,3},
			{3,5,4,3},
			{3,5,6,4},
			{3,4,3,1}};
	
	GameMap gMap = new GameMap(4,4,beforeMap);
	
	
	@Before
	public void setUp() throws Exception {
	
		gMap.output_map();
	}

	@Test
	public void testGetNeighborCount() {
	
		for(int i=0;i<gMap.getRows();i++) {
            for(int j=0;j<gMap.getCols();j++) {
            	//countOfNeighbor[i][j]代表i行j列细胞的邻居数，gMap[i][j]为游戏地图
            	assertEquals(countOfNeighbor[i][j], gMap.getNeighborCount(i, j));
            }
        }
	}
}
